<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition template="./TemplatePrincipal.xhtml">

            <ui:define name="top">
                Categoria
            </ui:define>

            <ui:define name="left">
                left
            </ui:define>

            <ui:define name="right">
                right
            </ui:define>

            <ui:define name="content">
                <h1>Categoria</h1>
                <h:form>
                    <h:commandButton action="MenuPrincipal" value="Menu Principal"/>
                    <h:commandButton action="CategoriaCrearEditar" value="Nueva Categoria" actionListener="#{categoryBean.prepararNuevo}" />
                    <f:view>
                        <h:form>
                            <h1><h:outputText value="List"/></h1>
                            <h:dataTable value="#{categoryBean.lista}" var="item">
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputText value="Id"/>
                                    </f:facet>
                                    <h:outputText value="#{item.id}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputText value="Clave"/>
                                    </f:facet>
                                    <h:outputText value="#{item.clave}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputText value="Descripcion"/>
                                    </f:facet>
                                    <h:outputText value="#{item.descripcion}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputText value="Color"/>
                                    </f:facet>
                                    <h:outputText value="#{item.color}"/>
                                    <h:commandButton action="CategoriaCrearEditar" value="Editar" actionListener="#{categoryBean.prepararEditar}"/>
                                    <h:commandButton action="CategoriaConfirmar" value="Eliminar" actionListener="#{categoryBean.prepararEliminar}"/>
                                </h:column>
                            </h:dataTable>
                        </h:form>
                    </f:view>

                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
